package com.jstorm.count.service.network.Impl;

import com.jstorm.count.dto.CommonExecution;
import com.jstorm.count.enums.ResultEnum;
import com.jstorm.count.mapper.network.NetworkMapper;
import com.jstorm.count.service.network.NetworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @ProjectName: common
 * @Package: com.jstorm.count.service.network.Impl
 * @ClassName: NetworkServiceImpl
 * @Description:
 * @Author: Mr_hu
 * @CreateDate: 2018/12/28 18:39
 * ***********************************************************
 * @UpdateUser: Mr_hu
 * @UpdateDate: 2018/12/28 18:39
 * @UpdateRemark: The modified content
 * @Version: 1.0
 * ***********************************************************
 * Copyright: Copyright (c) 2018
 **/
@Service
public class NetworkServiceImpl  implements NetworkService {



    @Autowired
    @SuppressWarnings("all")
    private NetworkMapper networkMapper;

    @Override
    public CommonExecution selectSum() {
        //数据库 查询

        List<Map<String, Object>> NetworkList = networkMapper.selectCount();
        //失败
        if (NetworkList == null){
            return new CommonExecution(ResultEnum.SELECTLISTMAP_NULL);
        }
        //成功
        return new CommonExecution(ResultEnum.SELECTLISTMAP_SUCCESS,NetworkList);
    }

    @Override
    public CommonExecution selectTotal() {
        //数据库 查询
        List<Map<String, Object>>  networkTotal = networkMapper.selectNetworkTotal();
        //失败
        if (networkTotal == null){
            return new CommonExecution(ResultEnum.SELECTTOTAL_NULL);
        }
        //成功
        return new CommonExecution(ResultEnum.SELECTTOTAL_SUCCESS,networkTotal);
    }


}
